﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BDS3M.Admin.Controls
{
    public partial class AddTinhThanhPho : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnAdd_Click(object sender, EventArgs e)
        {

            int nextid = Convert.ToInt32(DAL.DCollector.DBCollector.Instance.getNextID("tbl_TinhThanhPho", "TinhThanhPho_ID"));
            if (txtName.Text != "")
            {
                int idnextyahoo = nextid + 1;
                string value = "" + idnextyahoo + ",N'" + txtName.Text + "'";
                List<string> values = new List<string>();
                values.Add(value);
                DAL.DCollector.DBCollector.Instance.StoredProcedureInsertByRows("tbl_TinhThanhPho", "insertonerow", values, false);
                Response.Redirect("/Admin/Index.aspx?panel=1&sub=9");
            }
            else
            {
                Response.Write("<script>alert('Vui lòng nhập tên tỉnh thành phố...')</script>");
            }
        }
    }
}